package com.newer.dao.mapper.sys;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.newer.dao.bean.sys.RoleMenu;
import com.newer.dao.bean.sys.UserRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleMenuMapper extends BaseMapper<RoleMenu> {

    List<String> selectMenuIdsByRoles(@Param("userRoles") List<UserRole> userRoles);

    /**
     * 根据菜单Id查询角色菜单信息
     *
     * @param roleId
     * @return
     */
    @Select("select menu_id from s_auth_role_menu where role_id = #{roleId}")
    @Results({
            @Result(column = "menu_id", property = "menuId")
    })
    List<String> selectMenuIdsByRoleId(String roleId);
}